package com.cpms.framework.common.core.filter;



import com.alibaba.fastjson2.filter.ValueFilter;

import java.util.Arrays;

/**
 * @author gulang
 * @Description: fastjson value脱敏处理
 * @time: 2022/9/18 13:38
 */
public class SimpleDesensValueFilter implements ValueFilter {
    private String[] excludeFields;

    public SimpleDesensValueFilter(){

    }
    public SimpleDesensValueFilter(String[] excludeFields){
       this.excludeFields = excludeFields;
    }

    @Override
    public Object apply(Object o, String s, Object o1) {
        if(Arrays.asList(excludeFields).contains(s)) {
            return "****";
        }
        return o1;
    }
}
